package com.gm.wj.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @program: wj
 * @description: 课程
 * @author: Huang_shengjun
 * @create: 2020-08-27 21:28
 **/
@Data
@Entity
@Table(name = "sys_course")
@ToString
@JsonIgnoreProperties({ "handler","hibernateLazyInitializer" })
// 软删除
@SQLDelete(sql = "update sys_course set is_delete = 1 where id = ?")
@Where( clause = "is_delete = 0" )
public class SysCourse {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private int id;

    @NotEmpty(message = "课程名称不能为空")
    private String courseName;

    private String courseId;

    @NotEmpty(message = "课时/节不能为空")
    private String courseHour;

    @NotEmpty(message = "课程学费不能为空")
    private String courseTuition;

    @NotEmpty(message = "上课时间不能为空")
    private String courseTime;

    @NotNull(message = "课程类型不能为空")
    private int courseType;

    @NotNull(message = "人数不能为空")
    private int num;

    @NotEmpty(message = "开课老师不能为空")
    private String teacher;

    @NotEmpty(message = "课程描述不能为空")
    private String courseDesc;

    /**
     * 图片地址
     */
    @NotEmpty(message = "图片地址不能为空")
    private String imageUrl;

    /**
     * 视频地址
     */
    private String videoUrl;

    /**
     * 最后操作人
     */
    private String username;

    /**
     * 启用
     */
    private boolean display;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 人数是否已满
     */
    private int isNum;

    /**
     * 拼团价格
     */
    @NotEmpty(message = "拼团价格不能为空")
    private String ptTuition;


    /**
     * 0-未删除，1-已删除
     */
    /**
     * 软删除
     */
    @Column(name="is_delete")
    private int isDelete;
}
